#include<stdio.h>

typedef int Element;

const int MAX= 100;

inline void swap(Element * a, Element * b);
void swap(Element *a, Element* b)
{
    Element tmp = *a;
    *a = *b; *b = tmp;
}

int partition(Element* A, int l, int r)
{
    int pivot = A[r];
    int i = l-1;
    for(int j = l;j<r;++j)
    {
        if(A[j] <= pivot)
        {
            i+=1;
            swap(A+i,A+j);
        }
    }
    swap(A+i+1,A+r);
    return i+1;
}

void qsort_recur(Element* A, int l, int r)
{
    if(r>=l)
    {
        int p = partition(A,l,r);
        qsort_recur(A,l,p-1);
        qsort_recur(A,p+1,r);
    }

}

void QuickSort(Element* A, int N)
{
    qsort_recur(A,0,N-1);
}


int main(int argc, char const *argv[])
{
    freopen("./algorithm/test.txt","r",stdin);
    int N; scanf("%d",&N);
    int l[MAX]; for(int i=0;i<N;i++) scanf("%d",l+i);

    QuickSort(l,N);
    
    for(int i=0;i<N;++i)
    {
        printf("%d ",l[i]);
    }
    return 0;
}


